# def inser():
#     print("添加用户信息")
# def delete():
#     print("删除用户信息")
#
# def new_fun(fun):
#     def wrapper():
#         print("权限验证")
#         fun()
#     return wrapper
# new_inser = new_fun(inser)
# new_delete = new_fun(delete)
# new_inser()
# print("-----------")
# new_delete()


# money = [1000]
# def child_buy(money,toy,price):
#     money -= price
#     print(money)
# child_buy(money,"大熊猫",100)
# child_buy(money,"积木",200)

money = 1000
def get_money(money):
    print(f"我有{money}元")
    def child_buy(toy,price):
        nonlocal money
        money -= price
        print(f"买了{toy}，花费了{price}元，还剩{money}元")
    return child_buy
child_buy = get_money(money)
child_buy("积木",200)
child_buy("大熊猫玩偶",100)